/*
*  SheepDefence.cpp
*  SypXIPhone
*
*  Created by Luv Khemani on 5/8/10.
*  Copyright 2010 Luv Khemani. All rights reserved.
*
*/
#ifdef SYPX_MEMCHECK
#include "mmgr.h"
#endif

#include <SypX/SypX.h>
#include "Actor.h"
#include "IntroScene.h"
#include "SheepDefenceApp.h"


SypX::Engine* engine;
SypX::Font* font;
SheepDefence::Scene* activeScene;
SheepDefence::Scene* nextScene;

void handleInput()
{
	activeScene->handleInput();
}

void init()
{
	font = engine->loadFontFromFile("Fonts/sheepFont.ttf", 24, 3);
	activeScene = new SheepDefence::IntroScene(font);
	activeScene->init();

	nextScene = 0;
}

void changeScene(SheepDefence::Scene* s)
{
	nextScene = s;
}

void run()
{
	if(nextScene)
	{
		delete activeScene;
		activeScene = nextScene;
		nextScene = 0;
		activeScene->init();
	}

	activeScene->run();
}

int main(int argc, char *argv[])
{
	SypX::Engine::create();
	engine = SypX::Engine::getSingleton();
	engine->registerInitFunction(&init);
	engine->registerRunLoop(&run);
	engine->initAndStart(320,480);

	engine->removeFont(font);
	delete activeScene;

	SypX::Engine::destroy();

	return 0;
}
